<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>dwr test</title>

		<script type="text/javascript" src="dwr/engine.js"></script>
		<script type="text/javascript" src="dwr/interface/DemoDwr.js"></script>
		<script type="text/javascript" src="dwr/util.js"></script>
		<script type="text/javascript" src="js/dateUtil.js"></script>
	</head>
	<body>
		<script type="text/javascript">
	DemoDwr.test(function(data) {
		document.getElementById("show").innerHTML = data;
	});

	DemoDwr.query(function(data) {
		document.getElementById("date").innerHTML = data.date.format("yyyy-MM-dd hh:mm:ss");
	});

	var cellFun=[
	         		function(item){return item.id},
	         		function(item){return item.title},
	         		function(item){return item.content},
	         		function(item){
		         		var link=document.createElement("a");
		         		link.setAttribute("href","#");
		         		link.innerHTML="查看";
		         		return link;
		         		}
	         	];
	
	DemoDwr.getAll(10, 1, function(data) {
		//DWRUtil.removeAllRows("my_body");
		//添加到表格
		dwr.util.addRows("my_body",data,cellFun);
	});

</script>
		<div id="show"></div>
		<div id="date"></div>

		<table id="my">
			<thead id="my_head">
				<tr>
					<th>
						id
					</th>
					<th>
						title
					</th>
					<th>
						content
					</th>
					<th>
						操作
					</th>
				</tr>
			</thead>
			<tbody id="my_body">
			</tbody>
		</table>
	</body>
</html>
